package com.wzy.java;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class FilterDemo {
    public static void main(String[] args) {
        List<stuVO> studentList = new ArrayList<>();
        studentList.add(new stuVO(1, "张三", 23));
        studentList.add(new stuVO(2, "李四", 20));
        studentList.add(new stuVO(3, "王五", 19));
        studentList.add(new stuVO(4, "小明", 21));
        studentList.add(new stuVO(5, "小红", 24));

        // 获取去除小红之外的所有人的信息
        List<stuVO> collect = new ArrayList<>();
        collect = studentList.stream().filter(item -> (!"小红".equals(item.getName()))).collect(Collectors.toList());
        Iterator<stuVO> iterator = collect.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
    }
}
